package nero.yncc.com.createart.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;

import nero.yncc.com.createart.R;

/**
 * Created by nero on 17-6-27.
 */

public class AdapterSearchHistory extends RecyclerView.Adapter<AdapterSearchHistory.Holder> {

    Context context;
    ArrayList<String> arrayList;

    public AdapterSearchHistory(Context context, ArrayList<String> arrayList) {
        this.context = context;
        this.arrayList = arrayList;
    }

    @Override
    public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(context).inflate(R.layout.adapter_search_history,parent,false);
        Holder holder=new Holder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(Holder holder, int position) {
        holder.tv_content.setText(arrayList.get(position));
    }

    @Override
    public int getItemCount() {
        return arrayList.size();
    }

    class Holder extends RecyclerView.ViewHolder{
        TextView tv_content;
        public Holder(View itemView) {
            super(itemView);
            tv_content=itemView.findViewById(R.id.tv_content);
        }
    }
}
